#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <memory.h>
#include <stdlib.h>

typedef int dataType;
typedef struct Stack
{
	dataType* _array;
	size_t _size;
	size_t _capacity;
}Stack;


void StackInit(Stack* st, size_t n)
{
	st->_array = (dataType*)malloc(n*sizeof(dataType));
	st->_capacity = n;
	st->_size = 0;
}

void StackPush(Stack* st, dataType data)
{
	if (st->_capacity == st->_size)
	{
		st->_array = (dataType*)realloc(st->_array,st->_capacity * 2 * sizeof(dataType));
		st->_capacity *= 2;
	}
	st->_array[st->_size++] = data;
}

void StackPop(Stack* st)
{
	if (st->_size == 0)
	{
		return;
	}
	--st->_size;
}

dataType StackTop(Stack* st)
{
	if (st->_size == 0)
	{
		return NULL;
	}
	return st->_array[st->_size - 1];
}

int emptyStack(Stack* st)
{
	if (st->_size == 0)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

size_t StackSize(Stack* st)
{
	return st->_size;
}

void DestoryStack(Stack* st)
{
	if (st->_size > 0)
	{
		free(st->_array);
		st->_size = 0;
		st->_capacity = 0;
	}
}



int main()
{
	
	return 0;
}




	
